package cn.iune.erp.inventory;

import java.math.BigDecimal;
import java.sql.Date;
import java.text.ParseException;
import java.util.List;
import com.alibaba.fastjson.JSONObject;

import cn.iune.common.base.IBizDataIface;

public interface IStorageRecordDetailService extends IBizDataIface {

	List<StorageRecordDetail> getAll();

	StorageRecordDetail getByID(String fID);

	void delete(String fID);

	JSONObject save(JSONObject object) throws ParseException ;

	JSONObject queryZCGL(JSONObject data) ;

	List<StorageRecordDetail> getByMasterID(String fMasterID);
	
	StorageRecordDetail getWXPGByStep(String workNo, String procedureStep, String billType, String enterpriseNo);

	StorageRecordDetail getWXWGByStep(String workNo, String procedureStep, String billType, String enterpriseNo);

	List<StorageRecordDetail> getWXFLByStep(String workNo, String procedureStep, String billType,
			String enterpriseNo);

	List<StorageRecordDetail> getCostingLLDList(String workNo, Date dateStart, Date dateEnd, String enterpriseNo);

	List<StorageRecordDetail> getCostingRKDList(Date dateStart, Date dateEnd, String enterpriseNo);

	List<StorageRecordDetail> getOrderZYDByOrigin(String origin, Date dateStart, Date dateEnd, String enterpriseNo);

	int confirm(String fID);

	int active(String fID);

	int confirm(StorageRecordDetail srd);

	int active(StorageRecordDetail srd);

	int deleteByMasterID(String fMasterID);

	int confirmByMasterID(String fMasterID);

	int activeByMasterID(String fMasterID);

	//审核通过，改变审核状态为confirm
	StorageRecordDetail agreeIt(StorageRecordDetail srd);

	//审核拒绝，改变审核状态为active
	StorageRecordDetail unAgree(StorageRecordDetail srd);

	//审核通过，改变审核状态为confirm
	StorageRecordDetail agreeIt(String fID);

	//审核拒绝，改变审核状态为active
	StorageRecordDetail unAgree(String fID);

	int agreeItByMasterID(String fMasterID);

	int unAgreeByMasterID(String fMasterID);

	int agreeIt(List<StorageRecordDetail> srds);

	int unAgree(List<StorageRecordDetail> srds);

	int open(String fID);

	int close(String fID);

	int open(StorageRecordDetail srd);

	int close(StorageRecordDetail srd);

	int openByMasterID(String fMasterID);

	int closeByMasterID(String fMasterID);

//	int updateCheckoutTimes(StorageRecordDetail srd, String checkoutTimes);
//	int updateCheckoutTimes(StorageRecordDetail srd, String checkoutTimes, String act);




	//更新出入库成本（用于工单成本计算后更新生产/委外入库成本和存货计算完成后赋值出库单成本）
//	int updateCostingAmountPer(StorageRecordDetail srd, BigDecimal materialAmountPer, BigDecimal workingAmountPer,
//			BigDecimal manufactAmountPer, BigDecimal processAmountPer, BigDecimal costingAmountPer);

//	int doIt(StorageRecordDetail srd);

//	int unDo(StorageRecordDetail srd);

	StorageRecordDetail packing(StorageRecord master);

	void insert(StorageRecordDetail obj);

	//void afterInsert(StorageRecordDetail obj);

//	void beforeDelete(String fID);

	StorageRecordDetail update(StorageRecordDetail obj);

	//月底存货计价（此函数封存，库存管理系统中月底成本计价直接调用分成计算函数，低阶码为99）
//	int inventoryCalculate(String periodNo, String enterpriseNo);

	//月底存货计价（按低阶码分层计算）
//	int inventoryIlevelCalculate(String periodNo, String levelCode, String enterpriseNo);

	int updateDevolveCause(String fID, String devolveCause, String devolveCauseLabel);

	int updateBlankSize(JSONObject data);

	int updateMaterialType(String fID, int materialType, String materialTypeLabel);

	JSONObject queryJCJR(JSONObject data) ;

	int updateQualityStatus(StorageRecordDetail srd, int qualityStatus, String qualityStatusLabel);

	JSONObject querySimple(JSONObject data);

	int updateItemAmount(String fID, BigDecimal itemAmountNew);

	int updateProcedureStep(String fID, String procedureStep);

	StorageRecordDetail getByNo(String recordNo, String serialNo, String enterpriseNo);

	int updateQualityInfo(String audit, String checkoutTimes, String recordNo, String serialNo, String billType,
			String enterpriseNo, BigDecimal arriveAmount, BigDecimal itemAmount, BigDecimal wasterAmount,
			BigDecimal ullageAmount, BigDecimal arriveAmountBack, BigDecimal priceAmount, BigDecimal pieceQuantity,
			Date validDate, Date checkoutAgainDate, int qualityStatus, String qualityStatusLabel);

	int updateInvoiceItemQuantityIng(String recordNo, String serialNo, String enterpriseNo, BigDecimal invoiceQuantity);

	int updateEvaluateItemQuantityIng(String recordNo, String serialNo, String enterpriseNo,
			BigDecimal evaluateQuantity);

	int updateWasterItemQuantityIng(String recordNo, String serialNo, String billType, String enterpriseNo,
			BigDecimal itemQuantity);

	int updateWasterItemQuantity(String recordNo, String serialNo, String billType, String enterpriseNo,
			BigDecimal itemQuantity, BigDecimal pieceQuantity);

	int updateBackItemQuantityIng(String recordNo, String serialNo, String billType, String enterpriseNo,
			BigDecimal itemQuantity, BigDecimal wasterQuantity, BigDecimal ullageQuantity,
			BigDecimal arriveQuantityBack);

	int updateBackItemQuantity(String recordNo, String serialNo, String billType, String enterpriseNo,
			BigDecimal itemQuantity, BigDecimal wasterQuantity, BigDecimal ullageQuantity,
			BigDecimal arriveQuantityBack, BigDecimal pieceQuantity);

	JSONObject jointSimple(JSONObject data);

	List<StorageRecordDetail> getListByItemID(String itemID, Date dateStart, Date dateEnd, String enterpriseNo);

	List<StorageRecordDetail> getCostingWWDList(Date dateStart, Date dateEnd, String enterpriseNo);

	List<StorageRecordDetail> getCostingRKDListByWorkNo(Date dateStart, Date dateEnd, String workNo,
			String enterpriseNo);

	int updateInvoiceItemQuantity(String recordNo, String serialNo, String enterpriseNo, BigDecimal invoiceQuantity,
			BigDecimal costingAmount);

	int updateInvoiceItemQuantity(String recordNo, String serialNo, String enterpriseNo, BigDecimal invoiceQuantity);

	int updateEvaluateItemQuantity(String recordNo, String serialNo, String enterpriseNo, BigDecimal evaluateQuantity,
			BigDecimal costingAmount);

	List<StorageRecordDetail> getList(Date dateStart, Date dateEnd, String enterpriseNo);

	StorageRecordDetail packing(String billType, String billTypeName, String revOpay, int direction, String costingCode,
			String autoCode, String origin, String originName, String billNo, String userId, String enterpriseNo,
			String enterpriseName);
















}